package com.wc.codeforces.思维.Add_Zeros;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

/**
 * @Author congge
 * @Date 2024/10/26 23:06
 * @description https://codeforces.com/contest/2027/problem/C
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 300010;
    static long[] a = new long[N];
    static long[] q = new long[N];
    static Map<Long, ArrayList<Long>> map = new HashMap<>();
    static long res;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            int n = sc.nextInt();
            map.clear();
            for (int i = 1; i <= n; i++) {
                long x = sc.nextLong() - 1 + i;
                add(x, x + i - 1);
            }
            res = n;
            bfs(n);
            out.println(res);
        }
        out.flush();
    }

    static void add(long a, long b) {
        ArrayList<Long> ver = map.getOrDefault(a, new ArrayList<>());
        ver.add(b);
        map.put(a, ver);
    }

    static void bfs(long u) {
        int hh = 0, tt = 1;
        q[0] = u;
        while (hh < tt) {
            long t = q[hh++];
            res = Math.max(t, res);
            ArrayList<Long> ver = map.get(t);
            if (ver == null) continue;
            map.remove(t);
            for (long v : ver) {
                q[tt++] = v;
            }
        }
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
